import { vModelCheckbox } from "@vue/runtime-dom"
import { remove } from "@vue/shared"


export function error(s) {
    newLogBox(s,"#f03434")
}

export function success(s) {
    newLogBox(s,"#02b102")
}

function newLogBox(s,color) {
    let body = document.getElementsByTagName('body')[0]
    let box = document.createElement('div')
    box.style.minWidth = "150px"
    box.style.height = "80px"

    box.style.position = "fixed"
    box.style.top = "75%"
    box.style.left = "0%"
    box.style.background = "#fff"
    box.style.zIndex = "999"
    box.style.transition = "all 2s"
    box.style.borderRadius = "5px"
    box.style.paddingLeft = "15px"
    box.style.paddingTop = "15px"
    
    let p = document.createElement("p")
    p.style.fontSize = "14px"
    p.style.fontWeight = "300"
    p.style.width = "150px"
    p.textContent = s
    box.appendChild(p)

    let head = document.createElement("div")
    head.style.width = "10px"
    head.style.height = "80px"
    head.style.position = "absolute"
    head.style.top = "0%"
    head.style.left = "0%"
    head.style.background = color
    box.appendChild(head)
    body.appendChild(box)
    setTimeout(()=>{
        box.style.left = "-10%"
        setTimeout(()=>{
            box.remove()
            p.remove()
            head.remove()
        },2000)
    },1000)
}


